package com.zy.teacherSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.teacherSide.entity.Classroom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 29787
 */
@Mapper
@Component
public interface ClassroomDao extends BaseMapper<Classroom> {

    /**
     * 根据教师id查询班级信息
     * @param teacherId
     * @return List<Classroom>
     */
    @Select("select * from hms_classroom where teacher_id=#{teacherId}")
    List<Classroom> getAllClassroom(Integer teacherId);

    /**
     * 根据班级id查询班级信息
     * @param classroomId
     * @return Classroom
     */
    @Select("select * from hms_classroom where classroom_id=#{classroomId}")
    Classroom getClassroomByClassroomId(Integer classroomId);

    /**
     * 根据教师id和班级名称查重
     * @param classroomName
     * @param teacherId
     * @return Classroom
     */
    @Select("select * from hms_classroom where classroom_name=#{classroomName} and teacher_id=#{teacherId}")
    Classroom getClassroomByNameAndTeacherId(String classroomName,Integer teacherId);

}
